home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------*/
- /* filename - toptwin.cpp */
- /* */
- /* function(s) */
- /* TOptionWindow member functions */
- /*------------------------------------------------------------*/
-
- /*------------------------------------------------------------*/
- /* */
- /* Turbo Vision - Version 1.0 */
- /* */
- /* */
- /* Copyright (c) 1991 by Borland International */
- /* All Rights Reserved. */
- /* */
- /*------------------------------------------------------------*/
-
- #define Uses_TOptionWindow
- #define Uses_TWindow
- #define Uses_TOptionViewer
- #define Uses_TListViewer
- #define Uses_TCollection
- #include <tv.h>
- #include "TOption.h"
-
- TOptionInit::TOptionInit( TListViewer *(*cListViewer)( TRect, TWindow *,
- TCollection * ) ) :
- createListViewer( cListViewer )
- {
- }
-
- #define cpOptionWindow "\x13\x13\x15\x18\x17\x13\x14"
-
- TOptionWindow::TOptionWindow( const TRect& bounds,
- TCollection *aList ) :
- TOptionInit( &TOptionWindow::initViewer ),
- TWindow( bounds, 0, wnNoNumber),
- TWindowInit( &TOptionWindow::initFrame )
- {
- flags = wfClose;
- if( createListViewer != 0 &&
- (viewer = createListViewer( getExtent(), this, aList )) != 0 )
- insert( viewer );
- }
-
- TPalette& TOptionWindow::getPalette() const
- {
- static TPalette palette( cpOptionWindow, sizeof( cpOptionWindow )-1 );
- return palette;
- }
-
- void TOptionWindow::getSelection( char *dest )
- {
- viewer->getText( dest, viewer->focused, 255 );
- }
-
- TListViewer *TOptionWindow::initViewer( TRect r, TWindow * win,
- TCollection *aList )
- {
- r.grow( -1, -1 );
- return new TOptionViewer( r,
- win->standardScrollBar( sbHorizontal | sbHandleKeyboard ),
- win->standardScrollBar( sbVertical | sbHandleKeyboard ),
- aList );
- }
-
- TCollection *TOptionWindow::list()
- {
- return ((TOptionViewer *)viewer)->list();
- }
-
- void TOptionWindow::newList( TCollection *aList )
- {
- ((TOptionViewer *)viewer)->newList(aList);
- }
-